<template>
	<view class="success_container">
		<view class="mt_62 ml_16 mr_16 br_8 bc_fff ptb_44 plr_12 pr">
			<image class="icon width_66 height_66 br50 pa" src="@/static/images/success.png" mode=""></image>
			<view class="mt_22 fc fb" v-if="type == 'feedback'">
				提交成功，感谢您的反馈！
			</view>
			<view class="mt_22 fc fb" v-if="type == 'withdraw'">
				成功提交提现申请
			</view>
			<template v-if="type == 'withdraw'">
				<view class="fc fc_666">
					<view>
						请到线下门店兑换金豆
					</view>
					<view>
						兑换地址：{{ managerAddress }}
					</view>
				</view>
				<button class="w100 custom_btn default lh_44 br_57 mt_16" @click="handleBack(1)">返回我的金豆</button>
			</template>
		</view>
		<view class="pf l_0 r_0 b_0 pbsafe_50 fc_999 fx jcc">
			如遇到问题请及时联系<button class="block_btn fc_primary fz_14" open-type="contact">平台客服</button>
		</view>
	</view>
</template>

<script>
import api from '@/service/config/api'
export default {
	data() {
		return {
			type: '',
			setting: this.$storage.getItem('base_setting') || {},
			managerAddress: ""
		}
	},
	computed: {
		// shopAddress() {
		// 	if (this.$store.state.appType == this.$base.ADMIN_TYPE) {
		// 		return '成都市双流区元瑞建材家居城c栋三楼变色龙家居'
		// 	} else {
		// 		console.log("店铺地址")
		// 		console.log(this.managerAddress)
		// 		if (this.managerAddress) {
		// 			return this.shopAddress
		// 		} else {
		// 			return this.setting.shopAddress || ''
		// 		}
		// 	}
		// }
	},
	onLoad(options) {
		if (this.$store.state.appType == this.$base.ADMIN_TYPE) {
			this.managerAddress = '成都市双流区元瑞建材家居城c栋三楼变色龙家居'
			// return '成都市双流区元瑞建材家居城c栋三楼变色龙家居'
		}else {

			this.getshopAddress()
		}
		let title = ''
		uni.setNavigationBarColor({
			backgroundColor: '#fff',
			frontColor: '#000000'
		})
		this.type = options.type || ''
		switch (this.type) {
			case 'feedback':
				uni.setNavigationBarTitle({
					title: '意见反馈'
				})
				break
			case 'withdraw':
				uni.setNavigationBarTitle({
					title: '金豆提现'
				})
				break
			default:
				break
		}
	},
	methods: {
		// 获取店长地址
		getshopAddress() {
			api.get("/user/api/user/getManagerInfo").then(res => {
				if (res && res.code == 0) {
					console.log("店铺地址")
						console.log(this.managerAddress)
						if (res.data.shopAddress) {
							this.managerAddress = res.data.shopAddress
						} else {
							this.managerAddress = this.setting.shopAddress || ''
						}
				}
			})
		},
		handleBack(delta) {
			if (delta == 'home') {
				uni.reLaunch({
					url: '/pages/index/index'
				})
			} else {
				uni.navigateBack({
					delta
				})
			}
		}
	}
}
</script>

<style lang="scss">
@include color_page;
</style>

<style lang="scss" scoped>
.success_container {
	.icon {
		top: -58rpx;
		left: 0;
		right: 0;
		margin: 0 auto;
		z-index: 2;
	}

	.info_wrap {
		border-top: 1rpx solid rgba(0, 0, 0, 0.1);
	}
}
</style>